package service

import (
	"context"
	"gquickstarter/internal/repository"
	"gquickstarter/pkg/logger"
	"gquickstarter/pkg/units"
)

type IEmailService interface {
	SendCheckCodeEmail(ctx context.Context, email string) error
}
type EmailService struct {
	store  repository.IEmailRepository
	logger logger.LoggerWriter
}

func CreateEmailService(store repository.IEmailRepository, logger logger.LoggerWriter) IEmailService {
	return &EmailService{
		store:  store,
		logger: logger,
	}
}
func (e EmailService) SendCheckCodeEmail(ctx context.Context, email string) error {
	return e.store.CreateEmailCheckCode(ctx, email, units.GenValidateCode(6))
}
